<!DOCTYPE html>
<html>
<head lang="en">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
    <link rel="shortcut icon" href="img/smlogo.png" type="image/x-icon">
    <meta charset="UTF-8">
    <title>完善实名认证</title>
    <link rel="stylesheet" href="css/index2.css"/>
    <style>
        .Header .fixed_header .header_main .page_title{
            position:absolute;
            left:50%;
            -webkit-transform: translateX(-50%);
            -moz-transform: translateX(-50%);
            -ms-transform: translateX(-50%);
            -o-transform: translateX(-50%);
            transform: translateX(-50%);
        }
        #register{
            margin-top:44px;
            border-top:1px solid transparent;
        }
        #register li.form-item{
            background:#ececec;
            padding-top:10px;
        }
        #register input{background: #fff}
        #register h2{
            font-size: 16px;
            font-weight: bold;
            margin-left: 10px;
            margin-right:10px;
        }
        #register .text_note{
            margin:20px 10px;
            height:20px;
            line-height: 20px;
            font-size: 16px;
        }
        .text_note>span.rt{
            padding-left:20px;
            background: url(img/u602.png)no-repeat 1px 2px;
            background-size: 16px;
            font-size: 15px;
            color:#999;
        }
        i{
            display:inline-block;
            width:20px;
            height:20px;
            text-align: center;
            line-height: 21px;
            font-style: normal;
            border-radius: 50%;
            background: #D81E06;
            font-size: 15px;
            color:#fff;
            margin-right:5px;
        }
        li{list-style:none;font-size:16px;}
        .part1,.part2{
            height: 30px;
            box-sizing: border-box;
        }
        .part1{
            width:105px;
            line-height: 30px;
            margin-left: 10px;
            font-size: 15px;
        }
        .part2{
            margin-left: 125px;
            margin-right: 10px;
            padding: 3px 10px;
            background: #fff;
            border:1px solid #ccc;
        }
        .part2>input{width:100%;}
        #tishiinfor{
            padding:10px;
        }
        .btn-box{
            position:relative;
            padding:10px;
            height:80px;
            text-align: center;
        }
        .nextBtnOne{
            background: #008000;
            color:#fff;
            padding:5px 10px;
            border-radius: 3px;
            width: 250px;
            display: inline-block;
        }
        #part2 .imgDiv{
            position:relative;
            width:60px;
            height:60px;
            border:1px dashed #AEAEAF;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
        }
        #part2 .listDiv{  padding:10px;  }
        .imgBoxDiv{
            padding-top: 8px;
            padding-left: 40px;
        }
        .lastBtn,.saveBtn{
            display:inline-block;
            width:75px;
            height:22px;
            border-radius: 3px;
            background: rgba(0, 128, 0, 1);
            color:#fff;
            margin:40px 10px 0 10px;
        }

        article{padding:15px;}
        article h2{margin-top:10px;}
        article p{
            margin-top:5px;
            text-indent:15px;
            font-size: 15px;
        }

        #authenticateOk{
            display:none;
            position:fixed;
            top:0;
            bottom:0;
            left:0;
            width:100%;
            z-index: 1000;
            background: rgba(0,0,0,0.75);
        }
        #authenticateOk>div{
            position: relative;
            height:100%;
        }
        #authenticateOk>div>div{
            position:absolute;
            left:50%;
            top:50%;
            -webkit-transform: translate(-50%,-50%);
            -moz-transform: translate(-50%,-50%);
            -ms-transform: translate(-50%,-50%);
            -o-transform: translate(-50%,-50%);
            transform: translate(-50%,-50%);
            width:300px;
            background: #fff;
            padding:15px;
            font-size: 15px;
            box-sizing: border-box;
            border-radius: 4px;
        }
        .authenticateOkBtn{
            text-align: right;
            padding-top:20px;
            padding-bottom:5px;
            font-size:16px;
        }

        #part1{  display:block;  }
        #part2{  display:none;  }
        #authenticateHelp{  display:none;  }

        #sendimginfo{
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 3100;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.75);
            box-sizing: border-box;
        }
        #sendimginfo>div{
            position: relative;
            width:100%;
            height:100%;
            border-radius: 3px;
        }
        #sendimginfo>div>div{
            background: #fff;
            padding: 15px;
            border-radius: 3px;
            position: absolute;
            top: 50%;
            left:50%;
            -webkit-transform: translate(-50%, -50%);
            -moz-transform: translate(-50%, -50%);
            -ms-transform: translate(-50%, -50%);
            -o-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
        }
        #sendimginfo>div>div>p{
            text-align: center;
            min-width: 162px;
        }

        #digimgplace {
            height: 100vh;
            width: 100%;
            max-width: 1000px;
            position: relative;
            top: 0;
            background: #000000;
        }
        #delthisimgbtn, #bigimgback {
            position: absolute;
            right: 20px;
            top: 20px;
            z-index: 9999;
            height: 30px;
            width: 30px;
            max-width: 50px;
            max-height: 50px;
            border-radius: 50%;
            background: rgba(0,0,0,0.65) url(../img/delimg.png) no-repeat center;
            background-size: 20px;
        }
        #bigimgback {
            left: 20px;
            background: rgba(0,0,0,0.65) url(../img/ab3.png) no-repeat center;
            background-size: 40px;
        }
        #digimgplace>img {
            width: 100%;
            margin: auto 0;
            position: absolute;
            top: 50%;
            left: 50%;
            -webkit-transform: translate(-50%,-50%);
            -moz-transform: translate(-50%,-50%);
            -o-transform: translate(-50%,-50%);
            -ms-transform: translate(-50%,-50%);
            transform: translate(-50%,-50%);
        }
        .mainshowimgbox{
            width: 60px;
            height: 60px;
        }
        .mainshowimgbox img{
            width: 60px;
            height: 60px;
        }
        #confirmBtn{color:#999;}
    </style>
</head>
<body>
<!--验证-->
<div id="register">
    <!-- 头部-->
    <div class="Header ModalHeader">
        <div class="fixed_header">
            <div class="header_main">
                <div class="mweb_modal_back_button" id="backBtn"></div>
                <div class="page_title unified">
                    <span>完善实名认证</span>
                </div>
            </div>
        </div>
    </div>
    <p class="text_note">
        完善认证信息
        <span class="rt" id="helpBtn">认证帮助</span>
    </p>
    <div id="part1">
        <h2><i>1</i>确认及补充信息</h2>
        <ul class="bind_box">
            <li class="form-item">
                <div class="part1 lf">真实姓名:</div>
                <div class="part2">
                    <input id="realNameInput" type="text" class="field-text nofastclick r-focus" maxlength="7" placeholder="请输入真实姓名">
                </div>
            </li>
            <li class="form-item">
                <div class="part1 lf">手机号码</div>
                <div class="part2">
                    <input id="phonenumber" type="tel" class="field-text nofastclick r-focus" maxlength="11" placeholder="11位数字">
                </div>
            </li>
            <li class="form-item">
                <div class="part1 lf">身份证号码:</div>
                <div class="part2">
                    <input id="idInput" type="text" class="field-text nofastclick r-focus" placeholder="请输入身份证号码">
                </div>
            </li>
            <li class="form-item">
                <div class="part1 lf">职位/称号:</div>
                <div class="part2">
                    <input id="professionInput" type="text" class="field-text nofastclick r-focus" maxlength="7" placeholder="请输入职位/称号">
                </div>
            </li>
            <li class="form-item">
                <div class="part1 lf">公司/组织名称:</div>
                <div class="part2">
                    <input id="companyInput" type="text" class="field-text nofastclick r-focus" maxlength="7" placeholder="请输入公司/组织名称">
                </div>
            </li>
        </ul>
        <p id="tishiinfor" style="color:#DF2029;padding-top:10px;margin:0;height:20px;text-align: center;"></p>
        <div class="btn-box">
            <span class="nextBtnOne">下一步</span>
        </div>
    </div>
    <div id="part2">
        <h2><i>2</i>上传材料</h2>
        <div class="listDiv">
            <p>一、上传“真人手持身份证照片”</p>
            <div id="oneImgBox" class="imgBoxDiv">
                <div class="imgDiv">
                    +
                    <input type="file" onchange="selectFileImage(this,1)" style="position:absolute;top:0;bottom:0;left:0;width:100%;opacity: 0;z-index: 100;"/>
                </div>
            </div>
        </div>
        <div class="listDiv">
            <p>二、上传身份证正面照</p>
            <div id="twoImgBox" class="imgBoxDiv">
                <div class="imgDiv">
                    +
                    <input type="file" onchange="selectFileImage(this,2)" style="position:absolute;top:0;bottom:0;left:0;width:100%;opacity: 0;z-index: 100;"/>
                </div>
            </div>
        </div>
        <div class="listDiv">
            <p>三、上传职位/称号证明</p>
            <div id="threeImgBox" class="imgBoxDiv">
                <div class="imgDiv">
                    +
                    <input type="file" onchange="selectFileImage(this,3)" style="position:absolute;top:0;bottom:0;left:0;width:100%;opacity: 0;z-index: 100;"/>
                </div>
            </div>
        </div>
        <p id="tishiinfor2" style="color:#DF2029;padding-top:10px;margin:0;height:20px;text-align: center;"></p>
        <div class="btn-box">
            <span class="lastBtn">上一步</span>
            <span class="saveBtn">完成</span>
        </div>
    </div>
</div>
<!--认证完成-->
<div id="authenticateOk">
    <div>
        <div>
            <p>您的认证申请资料已提交成功！我们会在5个工作日内完成审核，请耐心等待。审核结果将以系统消息及短信形式告知，请保持手机畅通，注意查看</p>
            <div class="authenticateOkBtn">
                <span id="confirmBtn">确认</span>
            </div>
        </div>
    </div>
</div>
<!--认证帮助-->
<div id="authenticateHelp">
    <!-- 头部-->
    <div class="Header ModalHeader">
        <div class="fixed_header">
            <div class="header_main">
                <div class="mweb_modal_back_button" onclick="closeHelp()"></div>
                <div class="page_title unified">
                    <span>认证帮助</span>
                </div>
            </div>
        </div>
    </div>
    <!-- -->
    <div>
        <article>
            <h1>注意事项及证明材料说明</h1>
            <div>
                <h2>一、上传手持身份证照片</h2>
                <p>1.认证用户面部清晰可见，手持身份证置于胸前，但不要遮挡住用户面部</p>
                <p>2.照片放大后，身份证信息完整无遮挡，字迹清晰</p>
                <p>3.双手手臂完整漏出</p>
                <p>4.为保证身份证信息清晰，拍照时请将焦点对准身份证</p>
                <p>5.请确保提交的照片信息真实有效，切勿对照片及身份证信息做任何修改、PS、遮挡，否则将无法通过认证</p>
            </div>
            <div>
                <h2>二、上传身份照正面照</h2>
                <p>1.身份证正面照所有字迹完整清晰，无遮挡</p>
                <p>2.照片中身份证四个边角完全露出、无残缺、破损</p>
                <p>3.用户提交照片时，请确保身份证信息真实清晰有效，切勿做任何修改、PS、遮挡，否则将无法通过认证</p>
            </div>
            <div>
                <h2>三、上传在职证明/称号证明</h2>
                <p>上传下面任意一种或多种的对应证明材料进行认证即可</p>
                <p>1.在职证明：用户需要上传盖章工作证明的方式认证人在政府、机构、企业等单位正式在职工作身份</p>
                <p>2.职业资格证明：用户需要提交合法取得国家公认的职业资格证或从业资格证等方式认证本人职业身份或技能水平</p>
                <p>3.作品和获奖证明：用户需要提交在国内公开出版发行过的书刊、书画、唱片、电影、电视、舞蹈等作品证明材料认证本人身份及代表作品</p>
                <p>4.获奖/成就证明：用户需要提交在国际、国家级的重要、知名的赛事或活动中获得奖项或称号的证明材料来认证本人身份及主要成就</p>
                <p>以上证明材料都需完整清晰，并切勿做任何修改、PS、遮挡，否则将无法通过认证</p>
            </div>
        </article>
    </div>
</div>
<!--图片处理提醒-->
<div id="sendimginfo" style="display:none;">
    <div>
        <div>
            <p>正在处理图片，请耐心等待...</p>
            <p style="padding-top:10px;"><img src="img/imgloading2.gif"/></p>
        </div>
    </div>
</div>
<!-- 大图片-->
<div id="digimgplace" style="display: none;">
    <div id="delthisimgbtn" class="rt"></div>
    <div id="bigimgback" class="lf"></div>
    <img src="" id="showimg" style="width:100%;"/>
</div>
<script src="https://www.pulu.com/weixin/ftnjs/urlnote.js"></script>
<script src="https://www.pulu.com/weixin/js/jquery-1.11.3.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="../ftnjs/exif.js"></script>
<script>
    var handHoldImg="",IdCardImg="",onDutyImg="";
    var thisNum=0;
    function selectFileImage(fileObj,typeNum) {
        console.log(typeNum);
        var file = fileObj.files['0'];
        var Orientation = null;
        if (file) {
            console.log("正在上传,请稍后...");
            $("#sendimginfo").css("display","block");
            $("html").css("overflow","hidden");
            $("#sendimginfo p:first-child").html("正在处理图片");
            var rFilter = /^(image\/jpeg|image\/png|image\/jpg)$/i;
            if(file.type){
                if (!rFilter.test(file.type)) {
                    $("#sendimginfo").css("display","none");
                    alert("您的图片格式有误");
                    var code="";
                    for(var key in file){
                        code+=key+";";
                    }
                    return;
                }
            }
            EXIF.getData(file, function() {
                EXIF.getAllTags(this);
                Orientation = EXIF.getTag(this, 'Orientation');
            });
            var oReader = new FileReader();
            oReader.onload = function(e) {
                console.log("running");
                var image = new Image();
                image.src = e.target.result;
                var oldBase64=e.target.result;
                image.onload = function() {
                    var expectWidth = this.naturalWidth;
                    var expectHeight = this.naturalHeight;
                    if (this.naturalWidth > this.naturalHeight && this.naturalWidth > 700) {
                        expectWidth = 700;
                        expectHeight = expectWidth * this.naturalHeight / this.naturalWidth;
                    }
                    else if (this.naturalHeight > this.naturalWidth && this.naturalHeight > 700) {
                        expectHeight = 700;
                        expectWidth = expectHeight * this.naturalWidth / this.naturalHeight;
                    }
                    var canvas = document.createElement("canvas");
                    var ctx = canvas.getContext("2d");
                    canvas.width = expectWidth;
                    canvas.height = expectHeight;
                    ctx.drawImage(this, 0, 0, expectWidth, expectHeight);

                    var base64 = canvas.toDataURL("image/jpeg", 0.7);
                    if(Orientation != "" && Orientation != 1){
                        var canvasRotateImage=new Image();
                        canvasRotateImage.src=base64;
                        canvasRotateImage.onload = function(){
                            switch(Orientation){
                                case 6:
                                    rotateImg(this,'left',canvas);
                                    break;
                                case 8:
                                    rotateImg(this,'right',canvas);
                                    break;
                                case 3:
                                    rotateImg(this,'right',canvas);//转两次
                                    rotateImg(this,'right',canvas);
                                    break;
                            }
                            base64 = canvas.toDataURL("image/jpeg", 0.7);
                            lastSendImgFtn(base64,typeNum);
                        }
                    }else{
                        lastSendImgFtn(base64,typeNum);
                    }
                };
            };
            oReader.readAsDataURL(file);
        }
    }
    function lastSendImgFtn(base64,typeNum){
        $("#sendimginfo p:first-child").html("正在上传图片");
        $.ajax({
            type: "POST",
            url:  addimgurl,
            data: { "base64":base64, "type": ".jpg","flag":2},//flag:1表示头像，2普通照片
            success: function (data) {
                thisimgname=data.Data;
                $("html").css("overflow","auto");
                $("#sendimginfo").css("display","none");
                switch(typeNum){
                    case 1 :
                        $("#oneImgBox .imgDiv").css("display","none");
                        $("#oneImgBox").append(
                                "<div class='mainshowimgbox' onclick='showbigimg(this,1)' data-imgurl='"+thisimgname+"' data-img='"+thisimgname+"'><img src='"+imgurl+thisimgname+"'></div>");
                        handHoldImg=thisimgname;
                        $("#oneImgBox input").val("");
                        break;
                    case 2 :
                        $("#twoImgBox .imgDiv").css("display","none");
                        $("#twoImgBox").append(
                                "<div class='mainshowimgbox' onclick='showbigimg(this,2)' data-imgurl='"+thisimgname+"' data-img='"+thisimgname+"'><img src='"+imgurl+thisimgname+"'></div>");
                        IdCardImg=thisimgname;
                        $("#twoImgBox input").val("");
                        break;
                    case 3 :
                        $("#threeImgBox .imgDiv").css("display","none");
                        $("#threeImgBox").append(
                                "<div class='mainshowimgbox' onclick='showbigimg(this,3)' data-imgurl='"+thisimgname+"' data-img='"+thisimgname+"'><img src='"+imgurl+thisimgname+"'></div>");
                        onDutyImg=thisimgname;
                        $("#threeImgBox input").val("");
                        break;
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $("#sendimginfo p:first-child").html("图片上传失败");
                setTimeout(function(){
                    $("#sendimginfo").css("display","none");
                    clearTimeout();
                },2000)
            }
        });
    }
    function rotateImg(img, direction,canvas) {
        var min_step = 0;
        var max_step = 3;
        if (img == null)return;
        var height = img.height;
        var width = img.width;
        var step = 2;
        if (step == null) {
            step = min_step;
        }
        if (direction == 'right') {
            step++;
            step > max_step && (step = min_step);
        } else {
            step--;
            step < min_step && (step = max_step);
        }

        var degree = step * 90 * Math.PI / 180;
        var ctx = canvas.getContext('2d');
        switch (step) {
            case 0:
                canvas.width = width;
                canvas.height = height;
                ctx.drawImage(img, 0, 0);
                break;
            case 1:
                canvas.width = height;
                canvas.height = width;
                ctx.rotate(degree);
                ctx.drawImage(img, 0, -height);
                break;
            case 2:
                canvas.width = width;
                canvas.height = height;
                ctx.rotate(degree);
                ctx.drawImage(img, -width, -height);
                break;
            case 3:
                canvas.width = height;
                canvas.height = width;
                ctx.rotate(degree);
                ctx.drawImage(img, -width, 0);
                break;
        }
    }
    function showbigimg(e,typeNum){
        thisNum=typeNum;
        $("#digimgplace").css("display","block");
        $("#register").css("display","none");
        $("#digimgplace img").attr("src",imgurl+ e.dataset.imgurl);
    }
</script>
<script>
    $.ajax({
        type:"POST",
        url:userurl,
        data: {"loginuserId": $.cookie("MYID"),"userId": $.cookie("MYID")},
        datatype: "json",
        success:function(d){
            $("#realNameInput").val(d.Data.userNick);
            if(d.Data.IdCardNum){$("#idInput").val(d.Data.IdCardNum)}
        }
    });
    //验证身份证
    function scCard(){
        var scCard=document.getElementById("idInput").value;
        console.log(scCard);
        if(scCard.length!=0){
            if(!checkCard(scCard)){
                $("#tishiinfor").html("请输入正确的身份证号码");
                return false;
            }else{
                $("#tishiinfor").html("");
                return true;
            }
        }else{
            $("#tishiinfor").html("请输入正确的身份证号码");
            return false;
        }
    }
    //function checkidno(obj) {
    var vcity={ 11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",
        21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",
        33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",
        42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",
        51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
        63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"
    };
    checkCard = function(obj) {
        //校验长度，类型
        if(isCardNo(obj) === false) {return false;}
        //检查省份
        if(checkProvince(obj) === false) {return false;}
        //校验生日
        if(checkBirthday(obj) === false) {return false;}
        //检验位的检测
        if(checkParity(obj) === false) {return false;}
        return true;
    };
    //检查号码是否符合规范，包括长度，类型
    isCardNo = function(obj) {
        //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
        var reg = /(^\d{15}$)|(^\d{17}(\d|X)$)/;
        if(reg.test(obj) === false) {return false;}
        return true;
    };
    //取身份证前两位,校验省份
    checkProvince = function(obj) {
        var province = obj.substr(0,2);
        if(vcity[province] == undefined) {return false;}
        return true;
    };
    //检查生日是否正确
    checkBirthday = function(obj) {
        var len = obj.length;
        //身份证15位时，次序为省（3位）市（3位）年（2位）月（2位）日（2位）校验位（3位），皆为数字
        if(len == '15') {
            var re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/;
            var arr_data = obj.match(re_fifteen);
            var year = arr_data[2];
            var month = arr_data[3];
            var day = arr_data[4];
            var birthday = new Date('19'+year+'/'+month+'/'+day);
            return verifyBirthday('19'+year,month,day,birthday);
        }
        //身份证18位时，次序为省（3位）市（3位）年（4位）月（2位）日（2位）校验位（4位），校验位末尾可能为X
        if(len == '18') {
            var re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;
            var arr_data = obj.match(re_eighteen);
            var year = arr_data[2];
            var month = arr_data[3];
            var day = arr_data[4];
            var birthday = new Date(year+'/'+month+'/'+day);
            return verifyBirthday(year,month,day,birthday);
        }
        return false;
    };
    //校验日期
    verifyBirthday = function(year,month,day,birthday) {
        var now = new Date();
        var now_year = now.getFullYear();
        //年月日是否合理
        if(birthday.getFullYear() == year && (birthday.getMonth() + 1) == month && birthday.getDate() == day) {
            //判断年份的范围（3岁到100岁之间)
            var time = now_year - year;
            if(time >= 0 && time <= 130) {return true;}
            return false;
        }
        return false;
    };
    //校验位的检测
    checkParity = function(obj) {
        //15位转18位
        obj = changeFivteenToEighteen(obj);
        var len = obj.length;
        if(len == '18') {
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var cardTemp = 0, i, valnum;
            for(i = 0; i < 17; i ++) {cardTemp += obj.substr(i, 1) * arrInt[i];}
            valnum = arrCh[cardTemp % 11];
            if (valnum == obj.substr(17, 1)) {return true;}
            return false;
        }
        return false;
    };
    //15位转18位身份证号
    changeFivteenToEighteen = function(obj) {
        if(obj.length == '15') {
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var cardTemp = 0, i;
            obj = obj.substr(0, 6) + '19' + obj.substr(6, obj.length - 6);
            for(i = 0; i < 17; i ++) {cardTemp += obj.substr(i, 1) * arrInt[i];}
            obj += arrCh[cardTemp % 11];
            return obj;
        }
        return obj;
    };

    function testInputInfo(){
        $("#tishiinfor").html("");
        var profession=$("#professionInput").val();
        var companyInput=$("#companyInput").val();
        var reg=/0?(13|14|15|18)[0-9]{9}$/;
        var idReg=/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;
        if(!/^([\u4e00-\u9fa5]{1,7}|[a-zA-Z\.\s]{1,7})$/.test($("#realNameInput").val())){
            $("#tishiinfor").html("姓名不符合规范！");
            return false;
        }else if(!reg.test($("#phonenumber").val())){
            $("#tishiinfor").html("请输入正确的手机号！");
            return false;
        }else if(!scCard()){
            $("#tishiinfor").html("请输入正确的身份证号！");
            return false;
        }else if(!profession||/^\s+$/.test(profession)){
            $("#tishiinfor").html("请填写职位称号");
            return false;
        }else if(!companyInput||/^\s+$/.test(companyInput)){
            $("#tishiinfor").html("请填写公司组织名称");
            return false;
        }else{
            return true;
        }
    }
    function testImg(){
        $("#tishiinfor2").html("");
        if(!handHoldImg||!IdCardImg||!onDutyImg){
            $("#tishiinfor2").html("材料不完整");
            return false;
        }else{
            return true;
        }
    }
    function closeHelp(){
        $("#authenticateHelp").css("display","none");
        $("#register").css("display","block");
    }

    var helpFrom=0;
    var isSendAll=false;
    $("#backBtn").click(function(){
        //part1
        if($("#part1").css("display")=="block"){history.go(-1);}
        //help
        if($("#authenticateHelp").css("display")=="block"){
            $("#register .text_note").css("display","block");
            $("#authenticateHelp").css("display","none");
            if(helpFrom===0){$("#part1").css("display","block");}
            else if(helpFrom===1){$("#part2").css("display","block");}
        }
    });
    $("#helpBtn").click(function(){
        $("#part1").css("display","none");
        $("#part2").css("display","none");
        $("#register .text_note").css("display","none");
        $("#authenticateHelp").css("display","block");
    });
    $(".nextBtnOne").click(function(){
        if(testInputInfo()){
            $("#part1").css("display","none");
            $("#part2").css("display","block");
        }
    });
    $("#bigimgback").click(function(){
        thisNum=0;
        $("#digimgplace").css("display","none");
        $("#register").css("display","block");
        $("#digimgplace img").attr("src","");
    });
    $("#delthisimgbtn").click(function(){
        switch(thisNum){
            case 1 :
                $("#oneImgBox .imgDiv").css("display","block");
                $("#oneImgBox .mainshowimgbox").remove();
                handHoldImg="";
                break;
            case 2 :
                $("#twoImgBox .imgDiv").css("display","block");
                $("#twoImgBox .mainshowimgbox").remove();
                IdCardImg="";
                break;
            case 3 :
                $("#threeImgBox .imgDiv").css("display","block");
                $("#threeImgBox .mainshowimgbox").remove();
                onDutyImg="";
                break;
        }
        $("#digimgplace").css("display","none");
        $("#register").css("display","block");
        $("#digimgplace img").attr("src","");
    });
    $(".lastBtn").click(function(){
        $("#part2").css("display","none");
        $("#part1").css("display","block");
    });
    $(".saveBtn").click(function(){
        if(testImg()){
            if(!isSendAll){
                isSendAll=true;
                var validateAll={
                    "userId": $.cookie("MYID"),
                    "nick":$("#realNameInput").val(),
                    "companyName":$("#companyInput").val(),
                    "phoneNum":$("#phonenumber").val(),
                    "IdCardNum":$("#idInput").val(),
                    "duty":$("#professionInput").val(),
                    "handHoldImg":handHoldImg,
                    "IdCardImg":IdCardImg,
                    "onDutyImg":onDutyImg
                };
                $.ajax({
                    type:"POST",
                    url:validateAllUrl,
                    data:{"validateAll":validateAll},
                    success:function(d){
                        isAjax=false;
                        console.log(d);
                        $.cookie("validateLevel",2);
                        $("html").css("overflow","hidden");
                        $("#authenticateOk").css("display","block");
                    }
                })
            }
        }
    });
    $("#confirmBtn").click(function(){location.href="pulu.html";});
</script>
</body>
</html>